# Maintainer: Antonio Rojas <arojas@archlinux.org>
# Contributor: Andrzej Giniewicz <gginiu@gmail.com>
# Contributor: BinkyTheClown <binky_at_archlinux_dot_us>
# Contributor: Julien Ugon <bzklrm at gmail dot com>
# Contributor: Lex Black <autumn-wind at web dot de>
# Contributor: Gustavao A. Gomez Farhat <gustavo_gomez_farhat_at_gmail_dot_com>

pkgname=python-cvxopt
pkgver=1.3.2
pkgrel=3
pkgdesc='A free software package for convex optimization written in Python'
url='https://cvxopt.org/'
arch=(loong64 x86_64)
license=(GPL3)
depends=(blas
         glibc
         lapack
         python
         suitesparse)
makedepends=(gsl fftw glpk dsdp python-build python-installer python-setuptools-scm python-wheel)
optdepends=('gsl: for custom random number generators'
            'fftw: for FFTW interface'
            'glpk: solver for linear cone and PWL programming problems'
            'dsdp: solver for linear cone semidefinite programming problems')
source=(https://github.com/cvxopt/cvxopt/archive/$pkgver/$pkgname-$pkgver.tar.gz)
sha256sums=('03782bafebb86f33281a5451de5b5b648bb53ee8a1f97e38cae1d62e66a3bc72')

build() {
  cd cvxopt-$pkgver

  for lib in GSL FFTW GLPK DSDP; do
    eval "export $'CVXOPT_BUILD_$lib'=1"
  done
  SETUPTOOLS_SCM_PRETEND_VERSION=$pkgver \
  python -m build --wheel --no-isolation
}

package() {
  cd cvxopt-$pkgver
  python -m installer --destdir="$pkgdir" dist/*.whl
}
